package com.cndatacom.ccsinfoMgr.dao.impl;

import com.cndatacom.ccsinfoMgr.dao.IBulletinInfoDao;
import com.cndatacom.ccsinfoMgr.model.BulletinInfo;
import com.cndatacom.eweb.common.PaginationModel;
import com.cndatacom.eweb.common.PaginationSupport;

public class BulletinInfoDao extends PaginationSupport implements IBulletinInfoDao {

	public boolean delBulletinInfo(BulletinInfo bInfo) {
		getHibernateTemplate().delete(bInfo);
		return true;
	}

	public PaginationModel getAllBulletinInfo(int offset, int pageSize) {
		return searchPaginated("select bi from BulletinInfo bi order by bi.id desc", offset, pageSize);
	}

	public PaginationModel getBulletinInfoByHQL(String hql, int offset,
			int pageSize) {
		return searchPaginated(hql, offset, pageSize);
	}
	public BulletinInfo saveOrUpdateBulletinInfo(BulletinInfo binfo) {
		getHibernateTemplate().saveOrUpdate(binfo);
		return binfo;
	}

	public BulletinInfo getBulletinInfoById(int id) {
		return (BulletinInfo)getHibernateTemplate().get(BulletinInfo.class, new Integer(id));
	}

	

}

